import { wxRequest } from '../utils/wxRequest'

//const apiUrl = 'http://localhost:15536'
const apiUrl = 'https://onecodepay.leyifu.net'
//const apiUrl = 'https://wxopen.datous.com'

/**
 * 微信登陆接口
 * @param  {[type]} params code iv 等信息
 * @return {[type]}        登陆是否成功，其他信息
 */
const wxLogin = params => wxRequest(params, apiUrl + '/api/Identity/Jwtoken') // 登陆

const getShopByDistance = params => wxRequest(params, apiUrl + '/api/Store/GetShopByDistance') // 读取店铺
const getShop = params =>  wxRequest({}, apiUrl + '/api/Store/GetShop?id=' + params) // 读取店铺
const getCategory = params =>  wxRequest(params, apiUrl + '/api/Store/ReadCategory') // 读取店铺分类
const readOrder = params => wxRequest(params, apiUrl + '/api/Store/ReadOrder') // 读取用户自己的订单
const readCommission = params =>  wxRequest(params, apiUrl + '/api/Store/ReadCommission') // 分成明细
const getRewardStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/GetRewardStatistics') // 获取消费奖励记录数量统计
const withdraw = params => wxRequest(params, apiUrl + '/api/Wallet/Withdraw') // 提现
const sendWithdrawSms = params =>  wxRequest(params, apiUrl + '/api/Wallet/SendWithdrawSms') // 发送提现短信
const readWithdraw = params =>  wxRequest(params, apiUrl + '/api/Wallet/ReadWithdraw') // 提现列表
const getWithdrawSettings = params =>  wxRequest(params, apiUrl + '/api/Wallet/GetWithdrawSettings') // 获取提现设置
const readRecharge = params =>  wxRequest(params, apiUrl + '/api/Wallet/ReadRecharge') // 获取充值记录
const ReadWalletLog = params =>  wxRequest(params, apiUrl + '/api/Wallet/ReadWalletLog') // 获取余额消费记录
const getCommissionStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/getCommissionStatistics') // 获取推广奖励记录数量统计
const subUserStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/SubUserStatistics')
const readSubUser = params =>  wxRequest(params, apiUrl + '/api/Store/ReadSubUser')
const readShopTransferRecord = params =>  wxRequest(params, apiUrl + '/api/Store/ReadShopTransferRecord') // 读取店铺转账记录
const readOrderStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/readOrderStatistics')
const readShopOrder = params =>  wxRequest(params, apiUrl + '/api/Store/ReadShopOrder')//店铺订单列表
const addShopUser = params =>  wxRequest(params, apiUrl + '/api/Shop/AddShopUser')//添加店员
const deleteShopUser = params =>  wxRequest(params, apiUrl + '/api/Store/ReadShopOrder')// 删除店员
const commissionStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/CommissionStatistics')// 分成统计
const subShopStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/SubShopStatistics')//业务员推广的商铺统计
const readSalemanList = params =>  wxRequest(params, apiUrl + '/api/Store/ReadSalemanList')// 下级业务员列表
const readSubShop = params =>  wxRequest(params, apiUrl + '/api/Store/ReadSubShop') // 业务员推广的商铺列表
const readAgentShop = params =>  wxRequest(params, apiUrl + '/api/Store/readAgentShop') //某个代理旗下的 所有店铺列表
const createShop = params =>  wxRequest(params, apiUrl + '/api/Store/CreateShop') //新增店铺
const updateUserProfile = params =>  wxRequest(params, apiUrl + '/api/Identity/UpdateUserProfile')
const sendSms = params =>  wxRequest(params, apiUrl + '/api/Identity/SendSms') //发送手机验证码
const bindPhone = params =>  wxRequest(params, apiUrl + '/api/Identity/BindPhone')//绑定手机号
const resetPasswordByPhone = params =>  wxRequest(params, apiUrl + '/api/Identity/ResetPasswordByPhone') // 用手机号重置密码
const getUserInfo = params =>  wxRequest(params, apiUrl + '/api/Identity/UserProfile', 'GET')
const readShopStatistics = params =>  wxRequest(params, apiUrl + '/api/Store/ReadShopStatistics')//读取商家某个商店订单统计
module.exports = {
  wxLogin,
  apiUrl,
  getShopByDistance,
  getShop,
  getCategory,
  readOrder,
  readCommission,
  getRewardStatistics,
  withdraw,
  sendWithdrawSms,
  readWithdraw,
  getWithdrawSettings,
  readRecharge,
  ReadWalletLog,
  getCommissionStatistics,
  subUserStatistics,
  readSubUser,
  readShopTransferRecord,
  readOrderStatistics,
  readShopOrder,
  addShopUser,
  deleteShopUser,
  commissionStatistics,
  subShopStatistics,
  readSalemanList,
  readSubShop,
  readAgentShop,
  createShop,
  updateUserProfile,
  sendSms,
  bindPhone,
  resetPasswordByPhone,
  getUserInfo,
  readShopStatistics
}
